<#include "/common/defaultEngine.html"/>
<@pageTheme mark="${config.optimize()?string('true', 'false')}">
<@header title="新增运输" bodyClass="white-bg" libs=["prism","bootstrapSelect","ueditor"]/>
<div class="wrapper wrapper-content ibox-content">
    <@form.form id="form-transport-add" class="form-horizontal">
    <div class="form-group"><label class="col-sm-3 control-label"><@ctx.i18n text = "申请人"/>：
    </label>
        <div class="col-sm-8"><input name="applyUserName" class="form-control" type="text" value="${user.name}" readonly="true">
        </div>
    </div>
    <div class="form-group"><label class="col-sm-3 control-label"><@ctx.i18n text = "销售员"/>：
    </label>
        <div class="col-sm-8"><input name="saleUserid" class="form-control" type="text" readonly="true">
        </div>
    </div>
    <div class="form-group"><label class="col-sm-3 control-label"><@ctx.i18n text = "销售订单编号"/>：
    </label>
        <div class="col-sm-8"><input name="saleOrderNumber" class="form-control" type="text" readonly="true">
        </div>
    </div>
    <div class="form-group"><label class="col-sm-3 control-label"><@ctx.i18n text = "车辆识别号"/>：
    </label>
        <div class="col-sm-8"><input name="outCarVin" class="form-control" type="text" readonly="true">
        </div>
    </div>
    <div class="form-group"><label class="col-sm-3 control-label"><@ctx.i18n text = "车型"/>：
    </label>
        <div class="col-sm-8"><input name="outCarVehicle" class="form-control" type="text" readonly="true">
        </div>
    </div>
    <div class="form-group">
        <label class="col-sm-3 control-label"><span style="color: red; ">*</span><@ctx.i18n text = "提车地点"/>：</label>
        <div class="col-sm-8">
            <@form.select name="transportTakeCarPlace" dictType="sys_crm_takecarplace" required="true" />
        </div>
    </div>
    <div class="form-group takeClass"><label class="col-sm-3 control-label"><span style="color: red; ">*</span><@ctx.i18n text = "选择同事"/>：
    </label>
        <div class="col-sm-8"><input name="transportSelectColleague" class="form-control" type="text" required>
        </div>
    </div>
    <div class="form-group"><label class="col-sm-3 control-label"><span style="color: red; ">*</span><@ctx.i18n text = "提车地址"/>：
    </label>
        <div class="col-sm-8"><input name="transportTakeCarAddress" class="form-control" type="text" required>
        </div>
    </div>
    <div class="form-group"><label class="col-sm-3 control-label"><span style="color: red; ">*</span><@ctx.i18n text = "提车电话"/>：
    </label>
        <div class="col-sm-8"><input name="transportTakeCarPhone" class="form-control" type="text" required>
        </div>
    </div>
    <div class="form-group">
        <label class="col-sm-3 control-label"><span style="color: red; ">*</span><@ctx.i18n text = "送车地点"/>：</label>
        <div class="col-sm-8">
            <@form.select name="transportGiveCarPlace" dictType="sys_crm_takecarplace" required="true" />
        </div>
    </div>
    <div class="form-group giveClass"><label class="col-sm-3 control-label"><span style="color: red; ">*</span><@ctx.i18n text = "选择同事"/>：
    </label>
        <div class="col-sm-8"><input name="transportGiveSelectColleague" class="form-control" type="text" required>
        </div>
    </div>
    <div class="form-group"><label class="col-sm-3 control-label"><span style="color: red; ">*</span><@ctx.i18n text = "送车地址"/>：
    </label>
        <div class="col-sm-8"><input name="transportGiveCarAddress" class="form-control" type="text" required>
        </div>
    </div>
    <div class="form-group"><label class="col-sm-3 control-label"><span style="color: red; ">*</span><@ctx.i18n text = "送车电话"/>：
    </label>
        <div class="col-sm-8"><input name="transportGiveCarPhone" class="form-control" type="text" required>
        </div>
    </div>
    <div class="form-group">
        <label class="col-sm-3 control-label"><span style="color: red; ">*</span><@ctx.i18n text = "备注"/>：</label>
        <div class="col-sm-8">
            <textarea name="transportInfoRemark" class="form-control" required></textarea>
        </div>
    </div>

</@form.form>
</div>
<@footer>
<script type="text/javascript">
    $(function () {
        var transportTakeCarPlace = $("[name='transportTakeCarPlace'] option:checked").val();
        var transportGiveCarPlace = $("[name='transportGiveCarPlace'] option:checked").val();
        console.log("transportTakeCarPlace", transportTakeCarPlace, "transportGiveCarPlace", transportGiveCarPlace)
        if (transportTakeCarPlace == "7") {
            $(".takeClass").show();
        } else if (transportGiveCarPlace == "7") {
            $(".giveClass").show();
        } else {
            $(".giveClass").hide();
            $(".takeClass").hide();
        }
    })
    var prefix = baseURL + "bpm/transport"
    $("#form-transport-add").validate({
        focusCleanup: true
    });

    function submitHandler() {
        opt.warning("流程实例未启动，无法创建此申请单");
        return;
        if (opt.validate.form()) {
            opt.operate.save(prefix + "/add", $('#form-transport-add').serialize());
        }
    }

    /**
     * 下拉选择框 回调函数案例
     * @param id
     * @param event
     * @param data
     */
    function selectCallback(id, event, data) {
        console.log(data)
        if (id == "transportTakeCarPlace") {
            if (data[0].id == "7") {
                $(".takeClass").show();
            } else {
                $(".takeClass").hide();
            }
        } else if (id == "transportGiveCarPlace") {
            if (data[0].id == "7") {
                $(".giveClass").show();
            } else {
                $(".giveClass").hide();
            }
        }
    }
</script>
</@footer>
</@pageTheme>